package com.jbp.controller;

import com.jbp.model.EquipShop;
import com.jbp.service.EquipShopService;
import com.jbp.utils.PageUtils;
import com.jbp.utils.R;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Arrays;
import java.util.Map;

/**
 * 装备商店(EquipShop)表控制层
 * @author cc
 * @since 2020-08-31 18:43:09
 */
@Api(tags ="APP接口--EquipShop" )
@RestController
@ApiIgnore
@RequestMapping("equipShop")
public class EquipShopController {
    @Autowired
    private EquipShopService equipShopService;

    /** 列表 */
    @ApiOperation(value="列表")
    @ApiResponses({
            @ApiResponse(code = 200,message = "成功",response = EquipShop.class),
            @ApiResponse(code = 201,message = "返回失败信息")
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "size",value = "数量",paramType = "body"),
    })
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = equipShopService.queryPage(params);
        return R.ok().put("page", page);
    }
    
    @ApiOperation(value="信息")
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
        return R.ok(equipShopService.getById(id) );
    }
    
    /** 保存 */
    @RequestMapping("/save")
    public R save(@RequestBody EquipShop equipShop){
        equipShopService.save(equipShop);
        return R.ok();
    }

    /** 修改 */
    @RequestMapping("/update")
    public R update(@RequestBody EquipShop equipShop){
        equipShopService.updateById(equipShop);
        return R.ok();
    }

    /** 删除 */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        equipShopService.removeByIds(Arrays.asList(ids));
        return R.ok();
    }
}